cd "/Users/timo/Dropbox/research_projects/MP_TFP/replication_files/empirics"
global dirInput = "A_input" 
global dirTemp = "B_temp" 
global dirOutput = "C_results" 
global dir `c(pwd)' // current directory
global matlabPath = "/Applications/MATLAB_R2021a.app/bin/matlab"

* (1) Prepare macro data
* ==========================
*do 01_prepare_macro_data/01_fred_download // results of this are supplied as B_temp/fred_data_quarterly and B_temp/fred_data_monthly
do 01_prepare_macro_data/02_prep_other_data
do 01_prepare_macro_data/03_collect_macro_data

* (2) Prepare micro-macro data
* ===============================
do 02_prepare_micromacro_data/01_get_GP_industry_data.do
do 02_prepare_micromacro_data/02_prepare_rigidity.do
do 02_prepare_micromacro_data/03_prepare_compustat.do
do 02_prepare_micromacro_data/04_compute_markups.do
do 02_prepare_micromacro_data/05_finalize_ts_micromacro_data.do
do 02_prepare_micromacro_data/06_finalize_panel_micromacro_data.do
do 02_prepare_micromacro_data/07_prepare_svar_data.do

* (3) Descriptives
* =====================
do 03_descriptives/summary_stats_shocks.do
do 03_descriptives/summary_stats_compustat.do
shell $matlabPath -nodesktop -r "cd('${dir}/03_descriptives/'); tsplots_main; exit;"
shell $matlabPath -nodesktop -r "cd('${dir}/03_descriptives/'); tsplots_appendix; exit;"

* (4) Estimations with time series data
* =========================================
shell $matlabPath -nodesktop -r "cd('${dir}/04_local_projections/'); local_projections_main; exit;"
shell $matlabPath -nodesktop -r "cd('${dir}/04_local_projections/'); local_projections_appendix; exit;"
shell $matlabPath -nodesktop -r "cd('${dir}/07_svar/'); main_proxysvar; exit;"

* (5) Estimations with panel or firm-level data
* ===================================================
do 05_panel_local_projections/estimate_panel_lp.do
shell $matlabPath -nodesktop -r "cd('${dir}/05_panel_local_projections/'); panel_lp_figures; exit;"
do 06_firm_regressions/stickiness_markups.do
